package edu.sctu.lab04;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * Created by Administrator on 2018/5/31.
 */
public class userListServlet extends HttpServlet{
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {
        //jsp页面中没有任何的JAVA代码！！！
        Database database=new Database();
        List<User> userList=database.getuserList();

        //el表达式设计到的所有变量必须在四块空间里面定义。
        req.setAttribute("userList",userList);

        resp.sendRedirect("/userList.jsp");

       // req.getRequestDispatcher("/userList.jsp").forward(req,resp);
    }

}
